<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
<title>二网</title>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="navigation">
	    <span>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
	    </span>盘库管理&gt;&gt;二网管理
    </div>
<div class="xt_main_right_center">
<form name="searchForm" id="searchForm" onSubmit="return duibi();"   method="post" action="index.do">
  <table  width="100%" border="0" cellpadding="0" cellspacing="0"    style="border-color:#CCCCCC;"  >
    <tr>
      <td class="left-td-width-bg" >金融机构：</td>
      <td class="right-td-width-bg-left" >
      	<select class="select" name="search.financial.name" id="select">
          <option value="">****请选择****</option>
             <s:iterator value="financials" status="i" id="b">
          <option <s:if test='search.financial.name==#b.name'>selected="selected"</s:if>   value="${b.name }">${b.name }</option>
          </s:iterator>
          </select>
          </td>
      <td class="left-td-width-bg" >渠道：</td>
      <td class="right-td-width-bg-left" >
		<select  class="input" name="search.brand.name" id="select2">
		        <option  value="">****请选择****</option>
		         <s:iterator value="brands" status="i" id="b">
		          <option <s:if test='search.brand.name==#b.name'>selected="selected"</s:if>  value="${b.name }">${b.name }</option>
		          </s:iterator>
		      </select>
	  </td>
      <td class="left-td-width-bg" >4S店：</td>
      <td class="right-td-width-bg-left" >
      <jysz:autocompleter name="markShop" cssClass="input_ajax"  classType="com.jysz.certificate.persistence.model.system.Shop" displayFields="shopMark,shopName" fieldMapping="{'markShop':'shopMark'}">
</jysz:autocompleter>
</td>
    </tr>
    <tr>
      <td  class="left-td-width-bg" >驻店顾问：</td>
      <td class="right-td-width-bg-left" >
      <jysz:autocompleter name="userName" cssClass="input_ajax"  classType="com.jysz.certificate.persistence.model.system.User" displayFields="name,realName" fieldMapping="{'userName':'name'}">
</jysz:autocompleter>
 </td>
      <td  class="left-td-width-bg" >区域经理：</td>
      <td class="right-td-width-bg-left">
      <jysz:autocompleter name="managerUser"  cssClass="input_ajax"  classType="com.jysz.certificate.persistence.model.system.User" displayFields="name,realName" fieldMapping="{'managerUser':'name'}">
</jysz:autocompleter>
</td>      <td class="left-td-width-bg">状态：</td>
      <td class="right-td-width-bg-left">
		<s:select name="stateT" list="@com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@values()" theme="simple" listKey="index" listValue="name" headerKey="" headerValue="--请选择--" value="stateT"></s:select>
	  </td>
    </tr>
    <tr>
      <td class="left-td-width-bg">申请时间：</td>
      <td colspan="5">
      	<table width="21%">
        	<tr>
            	<td width="10%" class="right-td-width-bg-left"><input  class="Wdate"   type="text" name="startDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="startDate" format="yyyy-MM-dd"/>"/></td>
                <td width="1%" class="left-td-width-bg">至</td>
                <td width="10%" class="right-td-width-bg-left"><input  class="Wdate"   type="text" name="endDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="endDate" format="yyyy-MM-dd"/>"/></td>
            </tr>
        </table>
      </td>
      
      </tr>
    <tr style="background:url(${contextPath}/images/xt_main_right_dhbj.jpg) repeat-x;">
      <td colspan="6" align="right" style="border-bottom:none;"><label>
        <input type="submit" name="button2" class="btn_query" id="but" value="">
        <input type="reset" name="button" onClick="clearForm(this.form);return false;" class="btn_clear_form"  id="button" value="">
      </label></td>
      </tr>
  </table>
  </form>
</div>
  <table width="100%" border="0">
    <tr>
      <td colspan="2" align="right">&nbsp;</td>
    </tr>
    <tr>
      <td width="159" align="left"><font color="#0066CC"><strong>查询结果：</strong></font></td>
      
      <td width="1006" align="right">
      <jysz:permission code="CT_ADD"><a href="javascript:add()"><img src="${contextPath}/images/btn_add.png" alt="新增" /></a></jysz:permission>
      </td>
    </tr>
  </table>
  <table  width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td class="top-td-width-bg">序号</td>
      <td class="top-td-width-bg">二网申请号</td>
      <td class="top-td-width-bg">销售店</td>
      <td class="top-td-width-bg">金融机构</td>
      <td class="top-td-width-bg">驻店顾问</td>
      <td class="top-td-width-bg">区域经理</td>
      <td class="top-td-width-bg">申请日期</td>
      <td class="top-td-width-bg">申请总数</td>
      <td class="top-td-width-bg">通过总数</td>
      <td class="top-td-width-bg">状态</td>
      <td class="top-td-width-bg">操作</td>
    </tr>
    <s:iterator value="page.result" status="i" id="p">
    <tr>
      <td class="down-center-td-width-bg">${i.count }</td>
      <td class="down-center-td-width-bg">${p.theNumber }</td>
      <td class="down-center-td-width-bg">${p.shop.shopName }</td>
      <td class="down-center-td-width-bg">${p.financial.name }</td>
      <td class="down-center-td-width-bg"><s:property value="findUserShopByShopId(shop.id)"/></td>
      <td class="down-center-td-width-bg"><s:property value="getShopUserName(shop.id)"/></td>
       <td class="down-center-td-width-bg"><s:date name="#p.applicationDate" format="yyyy-MM-dd"/></td>
       <td class="down-center-td-width-bg"><s:property value="amount"/></td>
      <td class="down-center-td-width-bg"><s:property value="passAmount"/></td>
      <td class="down-center-td-width-bg"> ${p.state.name }</td>
      <td class="down-center-td-width-bg">

      <table align="center">
      	<tr>
      		<s:if test="@com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@NOTSTART.equals(state) || @com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@REFUSED.equals(state)">
      		<jysz:permission code="CT_EDIT">
	      		<td>
	      			<a href="javascript:update(${p.id })" title="编辑"><img src="${contextPath}/images/edit.gif" alt="编辑" width="16" height="13" border="0" /></a>
	      		</td>
	      	    <td>
	      			<a href="javascript:saveSubmit(${p.id })" title="提交"><img src="${contextPath}/images/tijiao.jpg" alt="提交" width="16" height="13" border="0" /></a>
      			</td>
      		</jysz:permission>
      		</s:if>
 			<s:if test="@com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@NOTSTART.equals(state) || @com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@REFUSED.equals(state) || @com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@SUBMITED.equals(state)">
	     		<jysz:permission code="CT_DEL">
		     		<td>
		      			<a href="javascript:del(${p.id })" title="删除"><img src="${contextPath}/images/del.gif" alt="删除" width="16" height="13" border="0" /></a>
		      		</td>
	      		</jysz:permission>
  			 </s:if>   
  			<s:if test="@com.jysz.certificate.persistence.enums.cs.TheNetWorkStatus@SUBMITED.equals(state)"> 
  				<jysz:permission code="CT_AUDIT">
  					<td> <a href="javascript:verify(${p.id })" title="审核"><img src="${contextPath}/images/audit.png" alt="审核" border="0" /></a> </td>
  				</jysz:permission>
  			</s:if>
      		<td><a href="javascript:sole(${p.id })" title="详情"><img src="${contextPath}/images/chakan.gif" alt="详情" width="16" height="18" border="0" /></a></td>
      	</tr>
      </table>
       </td>
    </tr>
    </s:iterator>
    <tr>
      <td class="down-center-td-width-bg"  colspan="11" align="right"> <%@ include file="/WEB-INF/view/common/pagination.jsp"%></td>
    </tr>
  </table>
<br/><br/><br/><br/><br/>
		<div><jsp:include page="/include/footer.inc"></jsp:include></div>
  <p>&nbsp;</p>

<script type="text/javascript">
		function jumpPage(page) {
			var searchForm = document.searchForm;
			searchForm.action = "<s:property value='contextPath'/>/cs/ct/index.do?currentPage=" + page;
			searchForm.submit();
		} 
function add(){
	var searchForm = document.searchForm;
	searchForm.action = "add.do?currentPage=${currentPage}";
	searchForm.submit();
}
function update(id){
		var searchForm = document.searchForm;
		searchForm.action = "addChoose.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
function del(id){
	if(confirm("是否删除")){
		var searchForm = document.searchForm;
		searchForm.action = "delete.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	
}
	function verify(id){
		var searchForm = document.searchForm;
		searchForm.action = "verify.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
function sole(id){
	var searchForm = document.searchForm;
	searchForm.action = "sole.do?currentPage=${currentPage}&id="+id;
	searchForm.submit();
}
function saveSubmit(id){
	 
	 var searchForm = document.searchForm;
		searchForm.action = "saveSubmit.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
}
function duibi() {
	var a=document.getElementById("startDate").value;
	var b=document.getElementById("endDate").value;
	if(null != a && null != b){
		var arr = a.split("-");
	    var starttime = new Date(arr[0], arr[1], arr[2]);
	    var starttimes = starttime.getTime();

	    var arrs = b.split("-");
	    var lktime = new Date(arrs[0], arrs[1], arrs[2]);
	    var lktimes = lktime.getTime();

	    if (starttimes >= lktimes) {
	    	alert("开始时间大于结束时间");
	        return false;
	    }
	     
	}else{
		return true;
	}
 }
</script>
</body>
</html>